<template>
  <div class="detil" v-if="DetilList.length !== 0">
    <div class="banner">
      <img :src="`https://ss.lanqb.com/${DetilList.posters.banner}`" />
      <div class="black">
        <h3>
          <span>{{ DetilList.title }}</span
          ><em>直播</em>
        </h3>
        <span>本期嘉宾： {{ DetilList.cooperator.nickname }}</span>
        <span>直播时间： {{ DetilList.begin_at.slice(0, 16) }}</span>
      </div>
    </div>
    <div class="content">
      <div class="Mycom">
        <div :class="{'introduce':true, 'Active':this.ComName=='IntroduceView'}" @click="changeCom('IntroduceView')">
          本期介绍
        </div>
        <div :class="{'zb':true,'Active':this.ComName=='ProductView'}" @click="changeCom('ProductView')">大触周边</div>
      </div>
      <component :is="ComName" :DetilList="DetilList"></component>
    </div>
    <div class="bottom">
      <span>￥10.00</span>
      <div class="but">
        <div class="teachButton">联系老师</div>
        <div class="yellowButton">立即报名</div>
      </div>
    </div>
  </div>
</template>

<script>
import IntroduceView from "@/components/IntroduceView.vue";
import ProductView from "@/components/ProductView.vue";

export default {
  name: "LiveDetil",
  components: {
    IntroduceView,
    ProductView,
  },

  data() {
    return {
      ComName: "IntroduceView",
      DetilId: 0,
      DetilList: [],
    };
  },
  async created() {
    this.$store.commit("setBar", false);
    this.DetilId = this.$route.params.id;
    const detil = await this.$http({
      methods: "GET",
      url: `/lqb/api/daniu/${this.DetilId}`,
    });
    console.log(detil.data);
    this.DetilList = detil.data;
  },
  beforeDestroy() {
      this.$store.commit("setBar", true);
  },
  mounted() {},

  methods: {
    changeCom(name) {
      this.ComName = name;
      console.log(this.ComName);
    },
  },
};
</script>

<style lang="scss" scoped>
.Active {
  color: #212b34;
  position: relative;
  &::after {
    position: absolute;
    content: "";
    width: 30px;
    height: 2px;
    background: #edce8c;
    left: 78px;
    bottom: -10px;
  }
}
.detil {
  height: 100vh;
  overflow-y: scroll;
  .banner {
    margin-top: -4px;
    width: 100vw;
    img {
      width: 100vw;
      height: 127px;
    }
    .black {
      box-sizing: border-box;
      padding-top: 14px;
      padding-left: 17px;
      margin-top: -4px;
      width: 100vw;
      height: 76px;
      background-color: #121d1c;
      > h3 {
        span {
          color: #fff;
          font-weight: 400;
        }
        em {
          display: inline-block;
          font-style: normal;
          font-weight: 400;
          padding: 3px 5px;
          margin-top: 5px;
          margin-left: 5px;
          font-size: 14px;
          line-height: 14px;
          color: #634b19;
          background-color: #edce8c;
          vertical-align: top;
          border-radius: 4px;
        }
      }
      > span {
        color: hsla(0, 0%, 100%, 0.6);
        font-size: 12px;
        padding-top: 5px !important;
      }
    }
  }
  .content{
    width: 100vw;
    height: 330px;
    overflow-y: scroll;
  .Mycom {
    color: #707070;
    width: 100vw;
    display: flex;
    justify-content: space-between;
    height: 50px;
    align-items: center;
    .introduce {
      width: 50vw;
      margin: auto;
      text-align: center;
    }
    .zb {
      width: 50vw;
      margin: auto;
      text-align: center;
      position: relative;
      &::before {
        content: "";
        width: 1px;
        height: 26px;
        background: #e6e6e6;
        position: absolute;
        top: -4px;
        left: 0;
      }
    }
  }
  }

  .bottom {
    box-shadow: 0 0 8.25px rgba(0, 0, 0, 0.08);
    padding-left: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100vw;
    height: 50px;
    background: #fff;
    position: fixed;
    bottom: 0;
    .span {
      text-align: center;
      margin-left: 15px;
    }
    .but {
      height: 50px;
      width: 70vw;
      display: flex;
      // justify-content: space-around;
      margin-left: 10px;
      .teachButton {
        width: 120px;
        line-height: 40px;
        height: 40px;
        text-align: center;
        margin: auto;
        color: #fff;
        border-radius: 25px;
        background: #ff7879;
        background-image: linear-gradient(180deg, #ffb0b1, #ff7879);
      }
      .yellowButton {
        width: 120px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        margin: auto;
        border-radius: 25px;
        background: #edce8c;
        background-image: linear-gradient(180deg, #f7e9c0, #edce8c);
      }
    }
  }
}
</style>
